const fs = require('fs')
const nodePath = require('path')

const path = '../src/locales/zh'
const files = fs.readdirSync(path)

const defaultFilePath = [path, '_default.json'].join('/')
let tempJSON = {}
files.forEach((v, k) => {
  const fileName = nodePath.parse(v).name
  const filePath = [path, v].join('/')
  const fileContent = fs.readFileSync(filePath)
  const temp = {
    [fileName]: JSON.parse(fileContent),
  }
  Object.assign(tempJSON, temp)
})

fs.writeFileSync(defaultFilePath, JSON.stringify(tempJSON))
